package com.woniuxy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author: 马宇航
 * @Todo: TODO
 * @DateTime: 25/08/26/星期二 15:37
 * @Component: 成都蜗牛学苑
 **/
@Controller
@RequestMapping("/login")
public class LoginController {
    @RequestMapping("")
    public ModelAndView login(ModelAndView modelAndView){
        //对应yml的两个配置
        //1.前缀 classpath:/templates/
        //2.后缀 .html
        //最终效果,去/templates/login.html 渲染到浏览器
        modelAndView.setViewName("login");
        modelAndView.addObject("msg","--蜗牛学苑");
        return modelAndView;
    }
    //SpringMVC 9大执行过程 面试常用
    @RequestMapping("/show")
    public String login(Model model){
        //对应yml的两个配置
        //1.前缀 classpath:/templates/
        //2.后缀 .html
        //最终效果,去/templates/login.html 渲染到浏览器
        model.addAttribute("msg","--蜗牛学苑");
        return "login";
    }
}
